package com.yaoq.singleton;

/**
 * @ClassName Singleton
 * @Description TODO
 * @Author yaoqiang
 * @Date 2020/9/9 10:36
 * @Version 1.0
 */
public class Singleton {
    private static volatile Singleton instance;

    private Singleton() {
    }

    ;

    public static synchronized Singleton getInstance() {
        if (instance == null) {
            synchronized (Singleton.class) {
                if (instance == null) {
                    instance = new Singleton();
                }
            }
        }
        return instance;
    }
}
